package com.hhz.swagger.dao;

import com.hhz.swagger.pojo.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

/**
 * @Author Rem
 * @Date 2019-08-02
 * @Version 1.0
 */

public interface UserDao extends JpaRepository<User, Integer>, JpaSpecificationExecutor<User> {


    User findByUsernameLikeAndAgeBetween(String username, int age1, int age2);

    User getByUsernameLikeAndAgeBetween(String username, int age1, int age2);

    @Query(value = "select * from user where username=:name and password=:pwd", nativeQuery = true)
    User findUserByNameAndPassword(String name, String pwd);
}
